#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) Huoty, All rights reserved
# Author: Huoty <sudohuoty@163.com>
# CreateTime: 2021-07-29 13:44:51

import multiprocessing
import time


try:
    input
except NameError:
    input = raw_input


def worker(d, key, value):
    d[key] = value
    time.sleep(3)


if __name__ == '__main__':
    mgr = multiprocessing.Manager()
    d = mgr.dict()
    jobs = [
	multiprocessing.Process(target=worker, args=(d, i, i*2))
        for i in range(3)
    ]
    for j in jobs:
        j.start()
    for j in jobs:
        j.join()
    print ('Results:')
    for key, value in enumerate(dict(d)):
        print("%s=%s" % (key, value))

    input("Press any key to exit")
